// 获取银行卡信息
// var getBankCard = "http://localhost:8080/hjcr-wechat/bankcard/getUserBankCrad";
var getBankCard = './json/getBankCard.json';
$(document).ready(function(){
  $.get(getBankCard,{params:{userId:sessionStorage.userId}},function(res) {
    if(res.serviceResult){
      var data = res.resultParm.list;
      var html="";
      for(var i=0;i<data.length;i++){
        var bank = bankName(data[i].bank);
        var type = cardType(data[i].cardType);
        var str = data[i].number;
        var num = str.substring(str.length-4,str.length);
        var x="" ;
        for (var j = 0; j <str.length-4;  j++) {
          x += "*";
          if((j+1)%4==0){x+=" ";}
        }

        html += '<div class="card bank-card-item">'+
            			'<p class="name">'+bank+'</p>'+
            			'<span class="meta">'+type+'</span>'+
            			'<img src="img/bankCard.png" alt="">'+
            			'<p class="id">'+x+num+'</p>'+
            		'</div>';
      }
      $(".myCard").empty().append(html);
    }
  });
});
